package com.naiterui.ehp.bs.cms.modules.user.feign;

import java.util.List;
import java.util.Map;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.naiterui.ehp.bp.support.config.FeignConfiguration;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.cms.modules.user.bo.record.RecordInfoBO;
import com.naiterui.ehp.bs.cms.modules.user.vo.DoctorInfoExcelVO;
import com.naiterui.ehp.bs.cms.modules.user.vo.record.RecordHospitalVO;

@RequestMapping("inner")
@FeignClient(name = "ad", url = "${ehp.domain.ad}", configuration = FeignConfiguration.class)
public interface DoctorFeignClient {

    @PostMapping("/audit/auth/save")
    void authAudit(@RequestBody String json) throws BusinessException;

    @PostMapping("/audit/record/save")
    void recordAudit(@RequestBody String json) throws BusinessException;

    @GetMapping("/doctor/{doctorId}/{status}")
    void accountStatus(@PathVariable("doctorId") Long doctorId,
                       @PathVariable("status")
                       @Max(value = 1, message = "状态不正确")
                       @Min(value = 0, message = "状态不正确") Integer status) throws BusinessException;

    @GetMapping("/doctor/{doctorId}/type")
    void accountType(@PathVariable("doctorId") Long doctorId,
                     @Max(value = 1, message = "状态不正确")
                     @Min(value = 0, message = "状态不正确") @RequestParam("type") Integer type) throws BusinessException;

    @PostMapping("/doctor/update")
    void update(@RequestBody String json) throws BusinessException;

    @PostMapping("/cms/record/doctor/update")
    void updateRecordInfoDr(@RequestBody RecordInfoBO recordInfo) throws BusinessException;

    @PostMapping("/cms/record/pharmacist/update")
    void updateRecordInfoPh(@RequestBody RecordInfoBO recordInfo) throws BusinessException;

    @GetMapping("/cms/record/hospital/info")
    RecordHospitalVO hospitalInfo();

    /**
     * 好评率
     * @param doctorIds
     * @return
     * @throws BusinessException
     */
    @PostMapping("consult/comment/praise/rate")
    Map<Long, String> getPraiseRate(@RequestBody List<Long> doctorIds);

    /**
     * 获取医生收费服务设置
     */
    @GetMapping("charge")
    Map<Long, Integer> doctorCharge(@RequestParam("doctorIds") String doctorIds, @RequestParam("type") Integer type);

    /**
     * 批量保存登录信息和医生信息
     */
    @PostMapping("doctor/batchSaveDoctor")
    void batchSaveDoctor(@RequestBody List<DoctorInfoExcelVO> doctorInfos) throws BusinessException;

    /**
     * 保存证件号
     * 
     * @param doctorId
     * @param number
     * @param type
     * @return
     * @throws BusinessException
     */
    @PostMapping("doctor/saveNumber")
    String saveNumber(@RequestParam Long doctorId, @RequestParam String number, @RequestParam Integer type)
        throws BusinessException;
}
